<extend name="Layout::index"/>
<block name="title"><title>影厅管理</title></block>
<block name="content">
    <!--右内容区域-->
    <div class="layout-content">
        <div class="page-title">放映厅管理</div>

        <div class="content-top">
            <ul class="top-nav">
                <li class="active"><span>放映厅列表</span></li>
            </ul>
            <div class="clearfix"></div>

        </div>
        <!--content-main end-->
        <div class="container-fluid content-main">
            <div class="row">
                <div class="col-md-12">

                    <div class="hide ui-tips bg-info" id="error">
                        <span class=" icon glyphicon glyphicon-info-sign">13123 </span>
                    </div>

                    <form class="form-horizontal" method="post" onsubmit="return false">

                        <div class="form-group">
                            <label class="col-sm-2 control-label">ID</label>

                            <div class="col-sm-8">
                                <input type="text" name="id" class="form-control" value="{$data['id']}" id="saveid" readonly="readonly">
                                <span class="help-block"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">影厅名</label>

                            <div class="col-sm-8">
                                <input type="text" name="name" class="form-control" value="{$data['name']}" id="save">
                                <span class="help-block"></span>
                            </div>
                        </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-8">
                        <button class="btn btn-default" id="revise">保存</button>
                    </div>
                </div>
                </form>
            </div>
        </div>

    </div>
    </div>
    <!--右内容区域结束-->
</block>
<block name="script">
    <script>
        $('#revise').click(function () {

            if ($('#save').val() == '') {
                $('#error').attr('class', 'ui-tips bg-info').find('span').html('请输入影厅');
            }


            $.ajax({
                url: "{:U('Room/docreate')}",
                type: 'POST',
                data: {'id': $('#saveid').val(), 'name': $('#save').val()},
                dataType: 'json',
                success: function (data) {
                     if(data){
                         window.location.href="{:U('Room/index')}";
                     }else{
                         $('#error').attr('class', 'ui-tips bg-info').find('span').html('修改影厅失败');
                     }
                }
             })
        })
    </script>
</block>
